export default () => {
  function scale() {
    const root = document.getElementById('app') as HTMLElement;
    const width = window.innerWidth;

    const height = window.innerHeight;
    const xRatio = width / 1920;
    const yRatio = height / 1080;

    root.style.cssText = `
        width:1920px;
        height:1080px;
        transform: scale(${xRatio}, ${yRatio});
        transform-origin: left top;
        overflow: hidden;`;
  }

  let lazy: number | undefined;
  window.onresize = () => {
    clearTimeout(lazy);
    lazy = setTimeout(() => {
      scale();
    }, 200) as any;
  };

  scale();
};
